package com.power.sifa.approve.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.domain.BaseModel;
import com.power.sifa.approve.model.enumeration.St_receipt;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  送达回执实体类
*/

@Entity
@ApiModel(value="送达回执")
@Data
@Table(name="Apl_arrive_receipt",schema="sfapprove")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = false)
//@IdClass(Apl_arrive_receipt.Apl_arrive_receiptPK.class) 用于复合组件
public class Apl_arrive_receipt extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1L;

    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "applyid+nanoid")
    private String id;

    @ApiModelProperty(value = "案号")
    private String code;

    @ApiModelProperty(value = "验证码")
    private String verifycode;

    @ApiModelProperty(value = "applyid")
    private String applyid;

    @ApiModelProperty(value = "送达记录id")
    private String recordid;

    @ApiModelProperty(value = "发送时间", example="2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date sendtime;

    @ApiModelProperty(value = "送达时间", example="2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date arrivetime;

    @ApiModelProperty(value = "状态")
    private Integer status = St_receipt.TODELIVER;


    @ApiModelProperty(value = "过期时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date expiredtime;

    @ApiModelProperty(value = "送达人员id")
    private String personid;

    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("code", this.getCode());
        map.put("applyid", this.getApplyid());
        map.put("recordid", this.getRecordid());
        map.put("sendtime", this.getSendtime());
        map.put("arrivetime", this.getArrivetime());
        map.put("status", this.getStatus());
        map.put("expiredtime", this.getExpiredtime());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Apl_arrive_receiptPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Apl_arrive_receiptPK pk = (Apl_arrive_receiptPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}
